<template>
	<view class="xiazai">
	
		<view class="nav_menus left">
			<view class="titie_body">
				<view class="body_line">
					<view class="left">
						
						<text v-if="lang==0">
							设备名
						</text>
						<text v-if="lang==1">
							dev_name
						</text>
						
					</view>
					<view class="right">
						<view class="text">
							{{name}}
						</view>
					</view>
				</view>
			</view>
			
			<view class="titie_body">
				<view class="body_line">
					<view class="left">
						
						<text v-if="lang==0">
							设备
						</text>
						<text v-if="lang==1">
							device
						</text>
						ID
					</view>
					<view class="right">
						<view class="text"  v-if="is_ios ==1">
							{{deviceInfo.ios_deviceId}}
						</view>
						<view class="text" v-else>
							{{deviceInfo.deviceId}}
						</view>
					</view>
				</view>
			</view>
			
			<view class="titie_body">
				<view class="body_line">
					<view class="left">
						
						<text v-if="lang==0">
							设备
						</text>
						<text v-if="lang==1">
							device
						</text>
						UUID
					</view>
					<view class="right">
						<view class="text">
							{{deviceInfo.advertisServiceUUIDs[0]}}
							
						</view>
					</view>
				</view>
			</view>
			
			<view class="titie_body">
				<view class="body_line">
					<view class="left">
						
						<text v-if="lang==0">
							服务
						</text>
						<text v-if="lang==1">
							service
						</text>
						UUID
					</view>
					<view class="right">
						<view class="text">
						{{serviceInfo.uuid}}
						</view>
					</view>
				</view>
			</view>
			
		<!-- 	<view class="titie_body">
				<view class="body_line">
					<view class="left">
						蓝牙自动连接
					</view>
					<view class="right">
						<view class="evan-switch">
							<evan-switch size="26" active-color="#507AFe"  v-model="data.is_lan"></evan-switch>
							
						</view>
					</view>
				</view>
			</view> -->
		<!-- 	<view class="titie_body">
				<view class="body_line">
					<view class="left">
						解除绑定
					</view>
					<view class="right">
						<view class="evan-switch">
							<evan-switch size="26" active-color="#507AFe"  v-model="data.is_bang"></evan-switch>
						</view>
					</view>
				</view>
			</view> -->
			<view class="titie_body"  @click="cs_openPicker()">
				<view class="body_line">
					<view class="left">
						
						<text v-if="lang==0">
							蓝牙模式
						</text>
						<text v-if="lang==1">
							LAN_MODE
						</text>
					</view>
					
					<view class="right">
						<view class="text">
								{{chesu[0][lan_bug]}} <image class="rightimg" src="../../../static/rightimg.png" mode=""></image>
						</view>
					</view>
					
				</view>
			</view>
			
		<!-- 	<view class="titie_body"  @click="cs_openPicker()">
				<view class="fa">
					<image class="icon" src="../../../static/mine2.png" mode=""></image>
					<view>模式切换</view>
				</view>
				<view class="rightimg_str"  >
					{{chesu[0][lan_bug]}}
				</view>
				<image class="rightimg" src="../../../static/rightimg.png" mode=""></image>
			</view> -->
			
			<view class="titie_body" @click="gen_ble_QR()">
				<view class="body_line">
					<view class="left">
						
						<text v-if="lang==0">
							蓝牙设备ID二维码
						</text>
						<text v-if="lang==1">
							LAN_DEV_QR_CODE
						</text>
					</view>
					
					<view class="right">
						<view class="text">
							<image class="rightimg1" src="../../../static/qrcode.png" mode=""></image>
						</view>
					</view>
				</view>
			</view>
			
			<view class="titie_body" v-for="(item,index) in bin_list" @click="daoru1(item.file)">
				<view class="body_line">
					<view class="left">
						
						<text v-if="lang==0">
							{{item.title}}
						</text>
						<text v-if="lang==1">
							{{item.title}}
						</text>
					</view>
					
					<view class="right">
						<view class="rightimg_str">
							
							<text v-if="lang==0">
								导入
							</text>
							<text v-if="lang==1" style="font-size: 11px;">
								import
							</text>
						</view>
					</view>
				</view>
			</view>
			
			
		</view>
		
		
	
		
	
			<view class="bomt">
			<!-- 	<view class="bom_top"  @click="daoru()">
					<view class="top1">
						<image src="/static/dr.png" mode=""></image>
						<view class="top2">
							
							<text v-if="lang==0">
								导入配置
							</text>
							<text v-if="lang==1">
								import
							</text>
						</view>
					</view>
				</view> -->
				<view class="bom_left" v-if="download_re_enter_disable==false"   @click="sentOrder()">
					<view style="font-size: 8px;position:absolute;top:-27px" v-if="binfile_path">
					
					<text v-if="lang==0">
						文件名
					</text>
					<text v-if="lang==1">
						file_name
					</text>
					
						:{{binfile_path[0].name}}
					</view>
					<view style="font-size: 8px;position:absolute;top:-17px" v-if="binfile_path">
						<text v-if="lang==0">
							文件大小
						</text>
						<text v-if="lang==1">
							file_size
						</text>
						:{{binfile_path[0].size}}
					</view>
				
					<text v-if="lang==0">
						下载BIN文件
					</text>
					<text v-if="lang==1">
						download_bin
					</text>
				</view>
				
				<view class="bom_left" v-if="download_re_enter_disable==true">
					<text v-if="percent==0">
						
						<text v-if="lang==0">
							正在下载
						</text>
						<text v-if="lang==1">
							Downloading
						</text>
					</text>
					<uv-line-progress  v-if="percent>0 && percent<100" :percentage="percent" height="35px" inactiveColor="#545b67" activeColor="#507afe"></uv-line-progress>
					<text v-if="percent==100">
						
						<text v-if="lang==0">
							开始下载
						</text>
						<text v-if="lang==1">
							complete
						</text>
					</text>
				
				</view>
				
				<view class="bom_right" @click="chooseMessageFile()">
				
				<text v-if="lang==0">
					打开bin文件
				</text>
				<text v-if="lang==1">
					open_bin_file
				</text>
					
				</view>
			</view>
		
		<view class="padding flex flex-wrap justify-between align-center">
		  <canvas type="2d" style="width: 300px; height: 300px;" id="myQrcode"></canvas>
		</view>
		
		<uv-picker
			cancelColor="#fff"
			confirmColor="#fff"
			color="#ccc"
			activeColor="#fff"
			ref="cs_picker"
			:columns="chesu"
			@confirm="cs_confirm"
		></uv-picker>
		<!-- <view class="nav_menus left" style="width: 100%;height: 200px;float: left;"></view> -->
		<!-- <tabbar :current="3"></tabbar> -->
	</view>
</template>


<script>
	
var app = getApp();	
import drawQrcode from '@/utils/weapp.qrcode.esm.js'
import utils from "@/utils/util.js"
import uvRadioGroup from "@/uni_modules/uv-radio/components/uv-radio-group/uv-radio-group.vue";
import { number } from "../../../uni_modules/uv-ui-tools/libs/function/test";
	export default {
		components: {
			uvRadioGroup
		},
		data() {
			return {
				is_ios:0,
				lang:0,
				data:{
						  pm_type_index: '',
						  voltage_level_index: '',
						  manufacturer_code_index: '',
						  over_voltage_value: '',
						  under_voltage_value: '',
						  soft_under_voltage_value: '',
						  under_voltage_threshold_value: '',
						  bus_current_limit_value: '',
						  phase_current_value: '',
						  vol_calibration_value: '',
						  cur_calibration_value: '',
						  sport_bus_current_limit: '',
						  low_speed_percent: '',
						  mid_speed_percent: '',
						  high_speed_percent: '',
						  flux_weak_value: '',
						  phase_Kp: '',
						  phase_current_limit_value: '',
						  turtle_speed_pecent: '',
						  soft_start_flag: '',
						  soft_start_flag: '',
						  motor_noise_forbid_falg: '',
						  setData: '',
						  setData: '',
						  motor_type_selcet_value: '',
						  dot_switch_selcet_flag: '',
						  turtle_speed_enable: '',
						  default_gear: '',
						  softstart_level_index: '',
						  sport_quit_time: '',
						  sport_recover_time: '',
						  flux_weak_compensate: '',
						  motor_shift_angle: '',
						  start_tempretrue_protect_value: '',
						  over_temperetrue_protect_value: '',
						  max_tempretrue_protect_value: '',
						  tempretrue_fact: '',
						  adj_fact1: '',
						  adj_fact2: '',
						  set_motor_dir: '',
						  sport_auto_quit_enable: '',
						  exchange_hall_flag: '',
						  exchange_motor_phase_flag: '',
						  auto_park_enable: '',
						  reverse_speed_limit_percent: '',
						  motor_pole_pair: '',
						  ebs_percent: '',
						  software_vision: '',
						  m_hardware_vision: '',
						  aux_move_enable_flag: '',
						  max_speed_limit_enable: '',
						  output_type_selcet_value: '',
						  cruise_enable_flag: '',
						  double_voltage_enable: '',
						  double_voltage_value: '',
						  safe_start_enable_flag: '',
						  aux_torque_limit_value: '',
						  aux_speed_limit_percent: '',
						  max_speed_limit_value: '',
						  low_speed_limit_current_percet: '',
						  mid_speed_limit_current_percet: '',
						  over_module_percent: '',
						  phase_Ki: '',
						  rated_phase_current_value: '',
						  rated_phase_current_limit_time: '',
						  function_select_index0: '',
						  function_select_radiobox0: '',
						  function_select_checkbox0: '',
						  function_select_index1: '',
						  function_select_radiobox1: '',
						  function_select_checkbox1: '',
						  function_select_index2: '',
						  function_select_radiobox2: '',
						  function_select_checkbox2: '',
						  function_select_index3: '',
						  function_select_radiobox3: '',
						  function_select_checkbox3: '',
						  function_select_index4: '',
						  function_select_radiobox4: '',
						  function_select_checkbox4: '',
						  function_select_index5: '',
						  function_select_radiobox5: '',
						  function_select_checkbox5: '',
						  function_select_index6: '',
						  function_select_radiobox6: '',
						  function_select_checkbox6: '',
						  function_select_index7: '',
						  function_select_radiobox7: '',
						  function_select_checkbox7: '',
						  flux_weak_calibration_value: '',
						  function_select_index8: '',
						  function_select_radiobox8: '',
						  function_select_checkbox8: '',
						  function_select_index9: '',
						  function_select_radiobox9: '',
						  function_select_checkbox9: '',
						  function_select_index10: '',
						  function_select_radiobox10: '',
						  function_select_checkbox10: '',
						  function_select_index11: '',
						  function_select_radiobox11: '',
						  function_select_checkbox11: '',
						  function_select_index12: '',
						  function_select_radiobox12: '',
						  function_select_checkbox12: '',
						  function_select_index13: '',
						  function_select_radiobox13: '',
						  function_select_checkbox13: '',
						  function_select_index14: '',
						  function_select_radiobox14: '',
						  function_select_checkbox14: '',
						  function_select_index15: '',
						  function_select_radiobox15: '',
						  function_select_checkbox15: '',
						  footplat_start_value: '',
						  footplat_end_value: '',
						  footplat_low_protect_value: '',
						  footplat_high_protect_value: '',
						  sink_ratio: '',
						  rise_ratio: '',
						  start_torque: '',
						  combine_torque: '',
						  nub:null,
						  
						  IO_PORT_select: ["功能选择1:", "功能选择2:", "功能选择3:", "功能选择4:", "功能选择5:", "功能选择6:", "功能选择7:",
						      "功能选择8:", "功能选择9:", "功能选择10:", "功能选择11:", "功能选择12:", "功能选择13: ", "功能选择14:", "功能选择15:", "功能选择16:"
						    ],
						  str_func_tab: [
						      "1:empty_func",
						      "2:low_speed_switch",
						      "3:horn_deal",
						      "4:lift_relay_output",
						      "5:high_speed_indication",
						      "6:high_speed_switch",
						      "7:egear_butten",
						      "8:stealavoid",
						      "9:lamehome",
						      "10:reverse_set",
						      "11:single_wire_communication",
						      "12:press_on_signal",
						      "13:hall_smulat_output",
						      "14:soft_start_selct",
						      "15:cruise_butten",
						      "16:high_break",
						      "17:park_input",
						      "18:turtle_speed",
						      "19:undef_IO_option",
						      "20:LY_safe_start",
						      "21:LY_undef_IO_option",
						      "22:charging_run_disable",
						      "23:TL_single_wire_communication",
						      "24:speed_limit",
						      "25:eabs_on_off",
						      "26:cruise_with_lamehome",
						      "27:egear_with_lamehome",
						      "28:low_break",
						      "29:half_test_single_wire_communication",
						      "30:park_with_lamehome",
						      "31:reverse_pressed_run",
						      "32:hill_down_disable",
						      "33:voltage_select",
						      "34:auto_cruise_enable",
						      "35:DRN_switch_D_butten",
						      "36:DRN_switch_R_butten",
						      "37:ebreak_ctl_deal",
						      "38:Ext_temp_KTY83_122",
						      "39:pre_charger",
						      "40:main_relay_on_deal",
						      "41:high_break_plus_deal",
						      "42:low_break_plus_deal",
						      "43:change_motor_direct",
						      "44:lift_butten",
						      "45:fall_butten",
						      "46:emergent_reverse_butten",
						      "47:adj_top_speed",
						      "48:lift_ctl_output",
						      "49:fall_ctl_output",
						      "50:ebreak_ctl_output",
						      "51:lift_pos_limit",
						      "52:LED_ERR_flash",
						      "53:reverse_indication",
						      "54:break_indication",
						      "55:potentiometer_general",
						      "56:truning_cut_speed",
						      "57:fpotentiometer_CAN",
						      "58:empty_func",
						      "59:empty_func",
						      "60:empty_func",
						      "61:empty_func",
						      "62:empty_func",
						      "63:empty_func",
						      "64:empty_func",
						      "65:empty_func",
						      "66:empty_func",
						      "67:empty_func",
						      "68:empty_func",
						      "69:empty_func",
						      "70:empty_func",
						      "71:empty_func",
						      "72:empty_func",
						      "73:empty_func",
						      "74:empty_func",
						      "75:empty_func",
						      "76:empty_func",
						      "77:empty_func",
						      "78:empty_func",
						      "79:empty_func",
						      "80:empty_func",
						      "81:empty_func",
						      "82:empty_func",
						      "83:empty_func",
						      "84:empty_func",
						      "85:empty_func",
						      "86:empty_func",
						      "87:empty_func",
						      "88:empty_func",
						      "89:empty_func",
						      "90:empty_func",
						      "91:empty_func",
						      "92:empty_func",
						      "93:empty_func",
						      "94:empty_func",
						      "95:empty_func",
						      "96:empty_func",
						      "97:empty_func",
						      "98:empty_func",
						      "99:empty_func",
						      "100:empty_func",
						      "101:empty_func",
						      "102:empty_func",
						      "103:empty_func",
						      "104:empty_func",
						      "105:empty_func",
						      "106:empty_func",
						      "107:empty_func",
						      "108:empty_func",
						      "109:empty_func",
						      "110:empty_func",
						      "111:empty_func",
						      "112:empty_func",
						      "113:empty_func",
						      "114:empty_func",
						      "115:empty_func",
						      "116:empty_func",
						      "117:empty_func",
						      "118:empty_func",
						      "119:empty_func",
						      "120:empty_func",
						      "121:H_CAN_ID",
						      "122:G_CAN_ID",
						      "123:F_CAN_ID",
						      "124:E_CAN_ID",
						      "125:D_CAN_ID",
						      "126:C_CAN_ID",
						      "127:B_CAN_ID",
						      "128:A_CAN_ID",
						    ],
						    param: 0,
						    page0_tx_message: new Uint8Array([0xc9, 0x14, 0x02, 0x50, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d]),
						    page1_tx_message: new Uint8Array([0xc9, 0x14, 0x02, 0x50, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d]),
						    page2_tx_message: new Uint8Array([0xc9, 0x14, 0x02, 0x50, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d]),
						    page3_tx_message: new Uint8Array([0xc9, 0x14, 0x02, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d]),
						    page4_tx_message: new Uint8Array([0xc9, 0x14, 0x02, 0x50, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d]),
						    page5_tx_message: new Uint8Array([0xc9, 0x14, 0x02, 0x50, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d]),
						    page6_tx_message: new Uint8Array([0xc9, 0x14, 0x02, 0x50, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d]),
						    param_read_success_flag: false,
						    inifile_path: "",
						    TabCur: 0,
						    MainCur: 0,
						    VerticalNavTop: 0,
						    list: [],
						    load: true,
							error_show:0,
							
				},
				 PageCur: 'param_config',
				textLog: "",
				//rec_data:"",
				deviceId: "",
				name: "",
				allRes: "",
				serviceId: "",
				readCharacteristicId: "",
				writeCharacteristicId: "",
				notifyCharacteristicId: "",
				canWrite: false,
				binfile_path: "",
				percent: 0,
				download_moden_flag: false,
				download_re_enter_disable: false,
				download_count: 0,
				totle_filesize_to_send: 0,
				platform: "android",
				Can_debug_mode: false,
				BLE_compatible_moden: false,
				ble_moden_value: 0,
				huadong1:0,
				huadong2:0,
				fangxiang: [{
					name: '正传',
					disabled: false
				}, {
					name: '反转',
					disabled: true
				}],
				leixing: [{
					name: 'V 型',
					disabled: false
				}, {
					name: '表贴',
					disabled: true
				}],
				yibiao: [{
					name: '一线通',
					disabled: false
				}, {
					name: '霍尔仪表',
					disabled: true
				}],
				shuangya: [{
					name: '低压',
					disabled: false
				}, {
					name: '高压',
					disabled: true
				}],
				
				boxTop: uni.getMenuButtonBoundingClientRect().top - 4 + 'px',
				boxRight: 375 - uni.getMenuButtonBoundingClientRect().left + 20 + 'px',
				boxHeight: uni.getMenuButtonBoundingClientRect().top + uni.getMenuButtonBoundingClientRect().height + 4 + 'px',
				banner: [
					{
						image: '../../../static/share2.png'
					},{
						image: '../../../static/share2.png'
					},{
						image: '../../../static/share2.png'
					}
				],
				id:0,
				chesu:[
					["蓝牙兼容模式","CAN调试模式"]
				],
				lan_bug:0,
				deviceInfo:null,
				serviceInfo:null,
				writeCharacteristicsInfo:null,
				notifyCharacteristicsInfo:null,
				bin_list:null
			};
		},
		onUnload() {
			app.globalData.is_rw = 0
		},
		onHide(){
			app.globalData.is_rw = 0;
		},
		onShow() {
			
			let platform = uni.getSystemInfoSync().platform;
			if(platform === 'ios'){
			 			this.is_ios = 1;
			 			
			   // 苹果
			 } else{
						this.is_ios = 0;
					  //   // 其他
					   console.log("其他")
			 }
			 
			 
			 
			app.globalData.is_rw = 1;
			
			if (uni.setKeepScreenOn) {
			  uni.setKeepScreenOn({
			    keepScreenOn: true,
			    success: function (res) {
			      console.log('保持屏幕常亮')
			    }
			  })
			}
			
		let _this = this;
		this.$api.request('/api/user/get_bin', {
		}, this.$store.state.token, function(res){
			if(res.code == 1) {
			
				_this.bin_list = res.data.data;
				
			}
		});
			
			if(uni.getStorageSync('lang')){
				this.lang =  uni.getStorageSync('lang');
			}
			
			if(this.lang == 1){
				this.chesu = [
					["Bluetooth compatibility mode","CAN debugging mode"]
				],
				uni.setNavigationBarTitle({
						 title: 'Bin file download'
				})
			}else{
				uni.setNavigationBarTitle({
					   title: 'bin文件下载'
				})
			}
			if(uni.getStorageSync('lan_bug')){
				this.lan_bug = uni.getStorageSync('lan_bug')
			}
			
				this.deviceList = uni.getStorageSync('deviceList');
				this.serviceInfo = uni.getStorageSync('serviceInfo');
				this.writeCharacteristicsInfo = uni.getStorageSync('writeCharacteristicsInfo');
				this.notifyCharacteristicsInfo = uni.getStorageSync('notifyCharacteristicsInfo');
				this.deviceInfo = uni.getStorageSync('deviceInfo');
				
					var that = this;
					var devid = this.deviceInfo.deviceId;//decodeURIComponent(options.deviceId);
					var devname = this.deviceInfo.name;//decodeURIComponent(options.name);
					var devserviceid = this.serviceInfo.uuid;//decodeURIComponent(options.serviceId);
					
					  that.deviceId = devid,
					  that.name = devname,
					  that.serviceId = devserviceid,
					  that.writeCharacteristicId = this.writeCharacteristicsInfo.uuid
					  
					 
					  
					  
					  that.platform = wx.getSystemInfoSync().platform
				 
				
						
					  that.ble_moden_value = app.globalData.CAN_debug_mode
					  that.Can_debug_mode = app.globalData.CAN_debug_mode
				
					uni.getStorage({
					  key: 'BLE_compatible_moden',
					  success(res) {
						console.log(res.data)
						if (res.data == true) {
						  that.data.BLE_compatible_moden = true;
						  let vaule = that.data.ble_moden_value;
						  vaule |= 2;
						  that.ble_moden_value = vaule
						}
					  }
					})
				console.log(7771,this.deviceInfo)
					//获取特征值
					that.getBLEDeviceCharacteristics();
				
		//this.deviceInfo.advertisServiceUUIDs[0]
		},
		onLoad(ops) {
		
		
			
			  
		},
		methods: {
			 gen_ble_QR(){
				
				
				// if (app.globalData.connected != true) {
				// 	if(this.lang==0){
				// 		uni.showToast({
				// 			title: '需要先连接蓝牙',
				// 			icon:"none"
				// 		})
				// 	}else{
				// 		uni.showToast({
				// 			title: 'Bluetooth needs to be connected first',
				// 			icon:"none"
				// 		})
				// 	}
				// 	return;
				// }
				let that = this;
				 
			    const query = wx.createSelectorQuery()
			    query.select('#myQrcode')
			      .fields({
			        node: true,
			        size: true
			      })
			      .exec((res) => {
			        var canvas = res[0].node
			        let str="{\"uid\":\""+uni.getStorageSync('userinfo').id+"\",\"uuid\":\""+that.deviceInfo.deviceId+"\"}";
					
			       //let str="openid:\""+app.globalData.wx_openid+"\",uuid:\""+app.globalData.ble_ManufacturerData+"\"";
			        console.log(str)
			        
			        // 调用方法drawQrcode生成二维码
			        drawQrcode({
			          canvas: canvas,
			          canvasId: 'myQrcode',
			          width: 300,
			          padding: 30,
			          background: '#ffffff',
			          foreground: '#000000',
			          text: str//app.globalData.ble_ManufacturerData,
			        })
			
			        wx.canvasToTempFilePath({
			          canvasId: 'myQrcode',
			          canvas: canvas,
			          x: 0,
			          y: 0,
			          width: 300,
			          height: 300,
			          destWidth: 300,
			          destHeight: 300,
			          success(res) {
			            console.log('二维码临时路径：', res.tempFilePath)
			            wx.showShareImageMenu({
			              path: res.tempFilePath,
			              success() {
			                console.log('cg')
			              },
			              fail: console.error,
			            })
			          },
			          fail(res) {
			            console.error(res)
			          }
			        })
			      })
			  },
			cs_openPicker(type) {
					this.$refs.cs_picker.open();
			},
			cs_confirm(e){
				  // 
				   console.log(555,e)
				 var index = e.indexs[0];var index = e.indexs[0];
				  // this.ble_moden_value = index;
				  this.lan_bug = index
				  uni.setStorageSync('lan_bug',index)
				  
			},
			getBLEDeviceCharacteristics() {
				
			    var that = this;
				console.log(7772,that.deviceId)
			       uni.getBLEDeviceCharacteristics({
			         deviceId: that.deviceId,
			         serviceId: that.serviceId,
			         success: function (res) {
			    						  	console.log(5)
			           for (let i = 0; i < res.characteristics.length; i++) {
			             let item = res.characteristics[i]
			             if (item.properties.read) { //该特征值是否支持 read 操作
			    					that.readCharacteristicId = item.uuid
			             }
			             if (item.properties.write) { //该特征值是否支持 write 操作
			               
			               that.writeCharacteristicId = item.uuid
			             }
			             if (item.properties.notify || item.properties.indicate) { //该特征值是否支持 notify或indicate 操作
			    				that.notifyCharacteristicId = item.uuid
			    							console.log(666666)
			    							//去写回调 
			               that.notifyBLECharacteristicValueChange();
			             }
			           }
			         }
			       })
			    // that.onBLECharacteristicValueChange();   //监听特征值变化
			  },
			  notifyBLECharacteristicValueChange(){
			  	 var that = this;
				   console.log(756);
				  console.log("监听",this.notifyCharacteristicId,this.serviceInfo.uuid)
			  	    uni.notifyBLECharacteristicValueChange({
			  	      type: "notification",
			  	      state: true, // 启用 notify 功能
			  	      deviceId: this.deviceInfo.deviceId,
			  	      serviceId: this.serviceInfo.uuid,
			  	      characteristicId: this.notifyCharacteristicId,
			  	      success: function (res) {
			  	      console.log("监听",777)
			  	        that.onBLECharacteristicValueChange(); //监听特征值变化
			  			
			  	      },
			  	      fail: function (res) {
			  	        // uni.showToast({
			  	        //   title: 'notify启动失败',
			  	        //   mask: true
			  	        // });
			  	        // setTimeout(function () {
			  	        //   uni.hideToast();
			  	        // }, 2000)
			  	      }
			  	    })
			  },
			  onBLECharacteristicValueChange(){
				 var that = this; 
			  	uni.onBLECharacteristicValueChange((res) => {
						const value = Array.prototype.map.call(new Uint8Array(res.value), (bit) => bit)
						if (that.download_re_enter_disable == true) {
			  	          app.globalData.rec_data = value;
			  	        } else {
			  	          utils.Rec_data_deal(value);
			  	        }
			  	})
			  },
			 
			  sentOrder: function () {
			    var that = this;
			    //wx.vibrateLong();
			
			      if (that.binfile_path.length > 0) {
					  console.log("下载...........1")
					  
			        if (that.download_re_enter_disable == false) {
						  console.log("下载...........2")
			          //var orderStr = that.data.orderInputStr;//指令
			          //let a =  new ArrayBuffer(24);
			          that.download_re_enter_disable = true;
					  
			          let strArray = new Uint8Array([0xc9, 0x14, 0x02, 0x42, 0x4c, 0x4f, 0x4f, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x95, 0x0d]);
			          //console.log(strArray);
			          that.writeBLECharacteristicValue(strArray.buffer);
					    console.log("下载...........3")
			          setTimeout(function () {
			
			            if (uni.setKeepScreenOn) {
			              uni.setKeepScreenOn({
			                keepScreenOn: true,
			                success: function (res) {
			                  console.log('保持屏幕常亮')
			                }
			              })
			            }
			  console.log("下载...........4",that.binfile_path)
			
			            const fs = uni.getFileSystemManager()
			            try {
			              let file_res = fs.readFileSync(that.binfile_path[0].path, 'binary', 0)
			              let order = utils.stringToBytes(file_res);
			              that.download_binfile(order);
			            } catch (e) {
			              console.error(e)
			            }
			          }, 300)
			        } else {
						
					 if(that.lang == 1){
						 uni.showToast({
						   title: 'Please wait for the download to complete',
						   icon: 'none',
						   duration: 1500
						 })
					 }else{
						 uni.showToast({
						   title: '请等待下载完成',
						   icon: 'none',
						   duration: 1500
						 })
					 }
			         
			        }
			      } else {
			        that.chooseMessageFile();
			        var nub = setInterval(function () {
			          if (that.binfile_path.length > 0) {
			            clearInterval(nub);
			            that.sentOrder();
			          }
			        }, 300)
			      }
			  
			  },
			  download_binfile (order) {
			     var that = this;
			     var _SOH = 0x01;
			     var _ACK = 0x06;
			     var _NAK = 0x15;
			     var _STX = 0x02;
			     var _EOT = 0x04;
			     var _CA = 0x18;
			     var _CRC16 = 0x43;
			     var blkNumber = 0;
			     var errors;
			     let pktstart = -1024;
			     let pktSize = 1024;
			     let timeout_value = 0;
			     let SET_TIMEOUT_VALUE = 1000;
			     app.globalData.rec_data = "";
				 that.totle_filesize_to_send = order.byteLength
				 that.download_moden_flag = true
			     that.download_count = 0
			 
			     var nub = setInterval(function () {
			       timeout_value++;
				   console.log(timeout_value,55555,SET_TIMEOUT_VALUE)
			       if (timeout_value > SET_TIMEOUT_VALUE) {
			         clearInterval(nub);
			         console.log("通讯超时",7773)
			         app.globalData.rec_data = "";
			         that.download_re_enter_disable = false
					 that.download_moden_flag = false
			       }
				      console.log(app.globalData.rec_data,22221);
			       if (utils.GetKey(app.globalData.rec_data, _CRC16)) {
					   console.log(2222);
					   
			         timeout_value = 0;
			         clearInterval(nub);
			         app.globalData.rec_data = "";
			         let strArray = new Uint8Array(128 + 3 + 2);
			         let temp = that.totle_filesize_to_send;
			         temp -= 128 * 2;
					 that.totle_filesize_to_send = temp
					 
			         let file_length = order.byteLength;
			         strArray[0] = _SOH;
			         strArray[1] = 0x00;
			         strArray[2] = 0xff;
			         let str = that.binfile_path[0].name;
			         for (let i = 0; i < str.length; i++) {
			           strArray[i + 3] = str.charCodeAt(i);
			         }
			         strArray[str.length + 3] = "\0";
			         let str1 = file_length.toString();
			         for (let i = 0; i < str1.length; i++) {
			           strArray[str.length + 4 + i] = str1.charCodeAt(i);
			         }
			         strArray[str.length + str1.length + 4] = "\0";
			         let crc16_value = utils.CRC16(strArray.slice(3, 128 + 3));
			         strArray[128 + 3] = (crc16_value & 0xff);
			         strArray[128 + 4] = ((crc16_value >> 8) & 0xff);
			         //console.log(strArray);
			         that.writeBLECharacteristicValue(strArray.buffer);
			         var nub2 = setInterval(function () {
			           timeout_value++;
			           if (timeout_value > SET_TIMEOUT_VALUE) {
			             clearInterval(nub2);
			             var log0 = that.textLog + "通讯超时";
			             console.log(log0,777)
			             app.globalData.rec_data = "";
			             that.download_re_enter_disable = false;
						 that.download_moden_flag = false;
			            
			           }
			           if (app.globalData.rec_data.length) {
			             if (file_length > 0) {
			               if (file_length >= 1024) {
			                 pktSize = 1024;
			               } else {
			                 pktSize = 1024;
			               }
			               if (utils.GetKey(app.globalData.rec_data, _ACK)) {
			                 timeout_value = 0;
			                 pktstart += pktSize;
			                 blkNumber++;
			                 if (file_length > pktSize) {
			                   file_length -= pktSize;
			                 } else {
			                   file_length = 0;
			                 }
			               }
			               if (pktstart >= 0) {
			                 let pr_packet_data
			                 if (pktstart + pktSize < order.byteLength) {
			                   pr_packet_data = order.slice(pktstart, pktstart + pktSize);
			                 } else {
			                   pr_packet_data = order.slice(pktstart, order.byteLength);
			                 }
			                 let temp = that.totle_filesize_to_send;
			                 temp += 5;
							 that.totle_filesize_to_send =  temp
			                 that.writeBLECharacteristicValue(that.Ymodem_PreparePacket(pr_packet_data, blkNumber).buffer);
			               }
			             } else {
			               clearInterval(nub2);
			               let EOT = new Uint8Array([0x04]);
			               that.writeBLECharacteristicValue(EOT.buffer);
			               var nub3 = setInterval(function () {
			                 if (timeout_value > SET_TIMEOUT_VALUE) {
			                   clearInterval(nub3);
			                   var log0 = that.textLog + "通讯超时";
			                   console.log(log0,7777)
			                   app.globalData.rec_data = "";
			                   that.download_re_enter_disable = false;
							   that.download_moden_flag = false;
			                 }
			                 if (utils.GetKey(app.globalData.rec_data, _ACK)) {
			                   timeout_value = 0;
			                   app.globalData.rec_data = "";
			                   clearInterval(nub3);
			                   let strArray1 = new Uint8Array(128 + 3 + 2);
			                   strArray1[0] = _SOH;
			                   strArray1[1] = 0x00;
			                   strArray1[2] = 0xff;
			                   let crc16_value = utils.CRC16(strArray1.slice(3, 128 + 3));
			                   strArray1[128 + 3] = (crc16_value & 0xff);
			                   strArray1[128 + 4] = ((crc16_value >> 8) & 0xff);
			                   that.writeBLECharacteristicValue(strArray1.buffer);
			                  that.download_re_enter_disable = false;
			                  that.download_moden_flag = false;
							
							
							
			                   //var log0 = that.data.textLog + that.data.binfile_path[0].name+"下载完成";
			                   var log0 = that.binfile_path[0].name + "下载完成";
			                   // uni.showToast({
			                   //   title: '下载完成',
			                   //   icon: 'none',
			                   //   duration: 1500
			                   // })
							
							   console.log("开始读取数据",777)
			                 
							   // uni.showModal({
							   //     title: '提示',
							   //     content: '导入完成',
							   //     success: function (res) {
							   //     }
							   // });
							   // setTimeout(function(){
									that.handleWriteValue();
							   // },2000)
							 
							
			                 }
			               }, 10)
			             }
			             app.globalData.rec_data = "";
			           }
			         }, 10)
			       }
			     }, 10)
			   }, 
			handleWriteValue(){
			
				// uni.setStorageSync('lan_bug',0);
				
				// uni.setStorageSync('dev_data', this.data);
				// uni.setStorageSync('deviceList', this.deviceList);
				// uni.setStorageSync('serviceInfo', this.serviceInfo);
				
				// uni.setStorageSync('writeCharacteristicsInfo', this.writeCharacteristicsInfo);
				// //notifyCharacteristicsInfo
				// uni.setStorageSync('notifyCharacteristicsInfo', this.notifyCharacteristicsInfo);
				// /**/
				// uni.setStorageSync('deviceInfo', this.deviceInfo);
				
				
				
				
				// 	app.globalData = {
				// 		userInfo: null,
				// 		sysinfo: null,
				// 		rec_data: '',
				// 		RxBuffer: new Uint8Array(48),
				// 		Receive_count: 0,
				// 		rx_status: 0,
				// 		rx_data_len: 0,
				// 		clc_check_code: 0,
				// 		Receive_time_out: 0,
				// 		success_count: 0,
				// 		error_count: 0,
				// 		show_switch_bit: 0,
				// 		motor_speed: 0,
				// 		mcu_bus_voltage: 0,
				// 		mcu_bus_current: 0,
				// 		mcu_q_voltage: 0,
				// 		mcu_d_voltage: 0,
				// 		mcu_q_currente: 0,
				// 		mcu_d_currente: 0,
				// 		Ext_temperatrue_senser:0,
				// 		MCU_temperatrue_senser: 0,
				// 		MCU_temperatrue_fact: 0,
				// 		mixed_flag_status_show: 0,
				// 		error_code: 0,
				// 		m_mcu_status_value: 0,
				// 		write_param_success_flag: false,
				// 		reset_mcu_success_flag: false,
				// 		connected: true,
				// 		Storage_deviceId: "",
				// 		auto_conect: true,
				// 		CAN_debug_mode: false,
				// 		fork_select_flag: false,
				// 		as: "k8BsXmqKQTQ7L1ifHnF2l03EPYG3h7", //AccessKey Secret
				// 		ble_productKey:"a1Rug9biACL",
				// 		productKey: "a1qEt2hbIqy",
				// 		productSecret: "hNy9fEImzmTVlLnI",
				// 		deviceName: "123456789",
				// 		endpoint: "https://iot.cn-shanghai.aliyuncs.com",
				// 		ai: "LTAI5tCLd4RwbUb9EYK8p2mP", //AccessKeyId
				// 		apiVersion: '2018-01-20',
				// 		ble_uuid: "123456702",
				// 		wx_openid:"",
				// 		services_uuid:"",
				// 		services_name:"",
				// 		ble_ManufacturerData:"",
				// 		client:null,
				// 		ble_write_enable:false,//true
				// 		mqtt_tx_enable:false
				// 	  }
				// app.globalData.connected = true;
				// app.globalData.is_yuancheng = 0;
				// app.globalData.error_code = 0;d
				
				
				// let is_ok = uni.getStorageSync('is_ok');
				// 			console.log(is_ok,777777777,'写入')
				// 			if(is_ok == 0){
				// 				if(this.lang == 0){
				// 					uni.showToast({
				// 					  title: '需要先提交二维码给客服',
				// 					  icon: 'none',
				// 					  duration: 1000
				// 					})
				// 				}else{
				// 					uni.showToast({
				// 					  title: 'You need to submit the QRcode to customer service first',
				// 					  icon: 'none',
				// 					  duration: 1000
				// 					})
				// 				}
				// 						return;
				// 			}
						
				if(this.lang == 0){
					//英文
								uni.showModal({
									title: '提示',
									content: '导入完成',
									success: function (res) {
										//读取文件
														
									 
									}
								});
				}else{
							uni.showModal({
								title: 'prompt',
								content: 'Import completed',
								cancelText: "cancel", // 取消按钮的文字  
								confirmText: "ok", // 确认按钮的文字  
								success: function (res) {
								  
								}
							});
				}
						return;
						
						
						console.log("监听读取数据")
						
			
				uni.onBLECharacteristicValueChange((res) => {
				  console.log('监听低功耗蓝牙设备的特征值变化1111', res)
				  // console.log(`characteristic ${res.characteristicId} has changed, now is ${res.value}`)
				  // console.log(ab2hex(res.value))
				
				  const value = Array.prototype.map.call(new Uint8Array(res.value), (bit) => bit)
				  console.log(value,9999999)
				  
				  this.funReadPage1(value)
				  
				  // this.Rec_data_deal(value);
				})
						
						
				let strArray = new Uint8Array([
				  0xc9, 0x14, 0x02, 0x4c, 0x44, 0x47, 0x45, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d,
				])
				let temp = strArray[0]
				for (let i = 1; i < strArray.length - 2; i++) {
				  temp ^= strArray[i]
				}
				strArray[strArray.length - 2] = temp
				const buffer = strArray.buffer
				
				// const buffer = new ArrayBuffer(1)
				// const dataView = new DataView(buffer)
				// dataView.setUint8(0, 0)
						
					console.log("写入数据",this.deviceInfo.deviceId)
				
				// 向低功耗蓝牙设备特征值中写入二进制数据
				uni.writeBLECharacteristicValue({
				  // 这里的 deviceId 需要在 getBluetoothDevices 或 onBluetoothDeviceFound 接口中获取
				  deviceId: this.deviceInfo.deviceId,
				  // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
				  serviceId: this.serviceInfo.uuid,
				  // 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
				  characteristicId: this.writeCharacteristicsInfo.uuid,
				  // 这里的value是ArrayBuffer类型
				  value: buffer,
				  writeType: 'writeNoResponse',
				  success(res) {
				    console.log('writeBLECharacteristicValue success', res.errMsg)
						  
						 
				  },
				  fail(error) {
				    console.log('fail')
				    console.log(error)
						  
				    if (error.errCode) {
				      uni.showToast({ title: errorCode[error.errCode], icon: 'none' })
				    } else if (error.errMsg) {
				      uni.showToast({ title: error.errMsg, icon: 'none' })
				    } else {
				      uni.showToast({ title: 'fail', icon: 'none' })
				    }
						  
				  },
				})
			},
			Ymodem_PreparePacket(order, pktNo) {
			 
			  },   
			funReadPage1(RxBuffer) {
			 
			},
			 writeBLECharacteristicValue(order) {
			     var that = this;
			     let byteLength = order.byteLength;
			     if (that.platform == "android") {
			       if (that.BLE_compatible_moden == true) {
			         var suport_data_length = 20;
			         var exe_cyc = 25;
			       }
			       else {
			         var suport_data_length = 20;
			         if (app.globalData.CAN_debug_mode == true) {
			           var exe_cyc = 5;
			         }
			         else {
			           var exe_cyc = 3;
			         }
			       }
			 
			     } else {
			       if (that.BLE_compatible_moden == true) {
			         var suport_data_length = 20;
			         var exe_cyc = 10;
			       }
			       else {
			         var suport_data_length = 128;
			         if (app.globalData.CAN_debug_mode == true) {
			           var exe_cyc = 10;
			         }
			         else {
			           var exe_cyc = 25;
			         }
			       }
			 
			     }
			 
			     wx.writeBLECharacteristicValue({
			       deviceId: that.deviceId,
			       serviceId: that.serviceId,
			       characteristicId: that.writeCharacteristicId,
			       // 这里的value是ArrayBuffer类型
			 
			       value: order.slice(0, suport_data_length),
			       success: function (res) {
			         if (byteLength > suport_data_length) {
			           setTimeout(function () {
			             that.writeBLECharacteristicValue(order.slice(suport_data_length, byteLength));
			           }, exe_cyc);
					   
			           if (that.download_moden_flag == true) {
			             let percent = that.download_count;
			             percent++;
			            
						 that.download_count = percent
			             percent = suport_data_length * 100 * percent / that.totle_filesize_to_send; //获取percent
			          
						 that.percent = percent.toFixed(0)
						 
						 
			           }
			         }
			         /*var log = that.data.textLog + "写入成功：" + res.errMsg + "\n";
			         that.setData({
			           textLog: log,
			         });*/
			 
			       },
			 
			       fail: function (res) {
			        console.log("写入失败" + res.errMsg + "\n")
			       
			       }
			 
			     })
			   }, 
			chooseMessageFile() {
				
				// if (app.globalData.connected != true) {
				// 	if(this.lang==0){
				// 		uni.showToast({
				// 			title: '需要先连接蓝牙',
				// 			icon:"none"
				// 		})
				// 	}else{
				// 		uni.showToast({
				// 			title: 'Bluetooth needs to be connected first',
				// 			icon:"none"
				// 		})
				// 	}
				// 	return;
				// }
				
				
			    var that = this;
			    if (that.download_re_enter_disable == false) {
			      wx.chooseMessageFile({
			        count: 1,
			        type: 'file',
			        extension: ['bin'],
			        success(res) {
							  console.log(res,979797)
			          //console.log('chooseMessageFile', res)
					  that.binfile_path = res.tempFiles
					  
					  console.log(that.binfile_path,979797)
			        }
			      })
			    } else {
			      if(that.lang == 1){
						 uni.showToast({
						   title: 'Please wait for the download to complete',
						   icon: 'none',
						   duration: 1500
						 })
			      }else{
						 uni.showToast({
						   title: '请等待下载完成',
						   icon: 'none',
						   duration: 1500
						 })
			      }
			    }
			 },
			 daoru1(file){
					
					let that = this;
					var url = file
					 wx.downloadFile({
					  url: url, //下载资源的地址网络
					  success: function (res) {
					   console.log(res.tempFilePath,9797979777)
							let tmp_file = res.tempFilePath;
							wx.getFileInfo({
								filePath: res.tempFilePath,
								success: function (res) {
									let s = [{
										name:"file bin",
										path:tmp_file,
										size: res.size
									}]
							
									
								  that.binfile_path = s
								
								  console.log(that.binfile_path,9797979776)
								}
							  })
					
			
						 // console.log(file_res,9797977777777777)
					   // 只要服务器有响应数据，就会把响应内容写入文件并进入 success 回调，业务需要自行判断是否下载到了想要的内容
					   // if (res.statusCode === 200) {
					   //  wx.playVoice({
					   //   filePath: res.tempFilePath
					   //  })
					   // }
					   // console.log(res.tempFilePath)
					   // 保存图片到本地
					   // wx.saveImageToPhotosAlbum({
					   //  filePath: res.tempFilePath,
					   //  success:
					   //   function (data) {
					   //    console.log(data);
					   //    wx.showModal({
					   //     title: '下载成功',
					   //     content: '图片以保存至您的手机',
					   //    })
					   //   },
					   // })
					  }
					 })
				 return;
				 
				 
				const fm = wx.getFileSystemManager() // 获取文件管理器

				const fileContent = fm.readFileSync(file, 'utf8', 0)
				console.log()
				 this.binfile_path = fileContent
				 // let inifile_path;
				 // uni.request({
				 //   url: file,
				 //   method: 'POST',
				 //   data: {
				 //     username: 'test',
				 //     password: '123456'
				 //   },
				 //   success: function(res) {
				 	  
				 // 	console.log(res.data,979797)
				 //     that.import_pararm_config(res.data);
				 //   }
				 // })
			 },
			daoru(){
					let that = this;
				if(this.data.xid ==0){
					that.data.json_arr = that.data;
					
					that.data.json_arr.soft_start_flag = that.data.json_arr.soft_start_flag==1?true:false
					
					that.data.json_arr.soft_start_flag = that.data.json_arr.soft_start_flag==1?true:false
					that.data.json_arr.max_speed_limit_enable = that.data.json_arr.max_speed_limit_enable==1?true:false
					that.data.json_arr.auto_park_enable = that.data.json_arr.auto_park_enable==1?true:false
					that.data.json_arr.turtle_speed_enable = that.data.json_arr.turtle_speed_enable==1?true:false
					that.data.json_arr.sport_auto_quit_enable = that.data.json_arr.sport_auto_quit_enable==1?true:false
					
					that.data.json_arr.exchange_hall_flag = that.data.json_arr.exchange_hall_flag==1?true:false
					that.data.json_arr.exchange_motor_phase_flag = that.data.json_arr.exchange_motor_phase_flag == 1?true:false
					
					that.data.json_arr.aux_move_enable_flag = that.data.json_arr.aux_move_enable_flag==1?true:false
					that.data.json_arr.double_voltage_enable = that.data.json_arr.double_voltage_enable==1?true:false
					
					
					that.data.json_arr.motor_noise_forbid_falg = that.data.json_arr.motor_noise_forbid_falg==1?true:false
					that.data.json_arr.safe_start_enable_flag = that.data.json_arr.safe_start_enable_flag==1?true:false
					that.data.json_arr.cruise_enable_flag = that.data.json_arr.cruise_enable_flag==1?true:false
					
					that.data.json_arr.set_motor_dir = Number(that.data.json_arr.set_motor_dir)
					that.data.json_arr.motor_type_selcet_value = Number(that.data.json_arr.motor_type_selcet_value);
					that.data.json_arr.output_type_selcet_value = Number(that.data.json_arr.output_type_selcet_value);
					that.data.json_arr.double_voltage_value = Number(that.data.json_arr.double_voltage_value)
					
					
					that.data.json_arr.dot_switch_selcet_flag = Number(that.data.json_arr.double_voltage_value)
					that.data.json_arr.default_gear = Number(that.data.json_arr.default_gear);
					
					that.data.json_arr.function_select_checkbox0 = Number(that.data.json_arr.function_select_checkbox0);
					that.data.json_arr.function_select_checkbox1 = Number(that.data.json_arr.function_select_checkbox1);
					that.data.json_arr.function_select_checkbox2 = Number(that.data.json_arr.function_select_checkbox2);
					that.data.json_arr.function_select_checkbox3 = Number(that.data.json_arr.function_select_checkbox3);
					that.data.json_arr.function_select_checkbox4 = Number(that.data.json_arr.function_select_checkbox4);
					that.data.json_arr.function_select_checkbox5 = Number(that.data.json_arr.function_select_checkbox5);
					that.data.json_arr.function_select_checkbox6 = Number(that.data.json_arr.function_select_checkbox6);
					that.data.json_arr.function_select_checkbox7 = Number(that.data.json_arr.function_select_checkbox7);
					that.data.json_arr.function_select_checkbox8 = Number(that.data.json_arr.function_select_checkbox8);
					that.data.json_arr.function_select_checkbox9 = Number(that.data.json_arr.function_select_checkbox9);
					that.data.json_arr.function_select_checkbox10 = Number(that.data.json_arr.function_select_checkbox10);
					that.data.json_arr.function_select_checkbox11 = Number(that.data.json_arr.function_select_checkbox11);
					that.data.json_arr.function_select_checkbox12 = Number(that.data.json_arr.function_select_checkbox12);
					that.data.json_arr.function_select_checkbox13 = Number(that.data.json_arr.function_select_checkbox13);
					that.data.json_arr.function_select_checkbox14 = Number(that.data.json_arr.function_select_checkbox14);
					that.data.json_arr.function_select_checkbox15 = Number(that.data.json_arr.function_select_checkbox15);
					
					
					that.data.json_arr.function_select_index0 = Number(that.data.json_arr.function_select_index0);
					that.data.json_arr.function_select_index1 = Number(that.data.json_arr.function_select_index1);
					that.data.json_arr.function_select_index2 = Number(that.data.json_arr.function_select_index2);
					that.data.json_arr.function_select_index3 = Number(that.data.json_arr.function_select_index3);
					that.data.json_arr.function_select_index4 = Number(that.data.json_arr.function_select_index4);
					that.data.json_arr.function_select_index5 = Number(that.data.json_arr.function_select_index5);
					that.data.json_arr.function_select_index6 = Number(that.data.json_arr.function_select_index6);
					that.data.json_arr.function_select_index7 = Number(that.data.json_arr.function_select_index7);
					that.data.json_arr.function_select_index8 = Number(that.data.json_arr.function_select_index8);
					that.data.json_arr.function_select_index9 = Number(that.data.json_arr.function_select_index9);
					that.data.json_arr.function_select_index10 = Number(that.data.json_arr.function_select_index10);
					that.data.json_arr.function_select_index11 = Number(that.data.json_arr.function_select_index11);
					that.data.json_arr.function_select_index12 = Number(that.data.json_arr.function_select_index12);
					that.data.json_arr.function_select_index13 = Number(that.data.json_arr.function_select_index13);
					that.data.json_arr.function_select_index14 = Number(that.data.json_arr.function_select_index14);
					that.data.json_arr.function_select_index15 = Number(that.data.json_arr.function_select_index15);
					
					that.data.json_arr.function_select_radiobox0 = Number(that.data.json_arr.function_select_radiobox0);
					that.data.json_arr.function_select_radiobox1 = Number(that.data.json_arr.function_select_radiobox1);
					that.data.json_arr.function_select_radiobox2 = Number(that.data.json_arr.function_select_radiobox2);
					that.data.json_arr.function_select_radiobox3 = Number(that.data.json_arr.function_select_radiobox3);
					that.data.json_arr.function_select_radiobox4 = Number(that.data.json_arr.function_select_radiobox4);
					that.data.json_arr.function_select_radiobox5 = Number(that.data.json_arr.function_select_radiobox5);
					that.data.json_arr.function_select_radiobox6 = Number(that.data.json_arr.function_select_radiobox6);
					that.data.json_arr.function_select_radiobox7 = Number(that.data.json_arr.function_select_radiobox7);
					that.data.json_arr.function_select_radiobox8 = Number(that.data.json_arr.function_select_radiobox8);
					that.data.json_arr.function_select_radiobox9 = Number(that.data.json_arr.function_select_radiobox9);
					that.data.json_arr.function_select_radiobox10 = Number(that.data.json_arr.function_select_radiobox10);
					that.data.json_arr.function_select_radiobox11 = Number(that.data.json_arr.function_select_radiobox11);
					that.data.json_arr.function_select_radiobox12 = Number(that.data.json_arr.function_select_radiobox12);
					that.data.json_arr.function_select_radiobox13 = Number(that.data.json_arr.function_select_radiobox13);
					that.data.json_arr.function_select_radiobox14 = Number(that.data.json_arr.function_select_radiobox14);
					that.data.json_arr.function_select_radiobox15 = Number(that.data.json_arr.function_select_radiobox15);
					
					
					
					app.globalData = {
							userInfo: null,
							sysinfo: null,
							rec_data: '',
							RxBuffer: new Uint8Array(48),
							Receive_count: 0,
							rx_status: 0,
							rx_data_len: 0,
							clc_check_code: 0,
							Receive_time_out: 0,
							success_count: 0,
							error_count: 0,
							show_switch_bit: 0,
							motor_speed: 0,
							mcu_bus_voltage: 0,
							mcu_bus_current: 0,
							mcu_q_voltage: 0,
							mcu_d_voltage: 0,
							mcu_q_currente: 0,
							mcu_d_currente: 0,
							Ext_temperatrue_senser:0,
							MCU_temperatrue_senser: 0,
							MCU_temperatrue_fact: 0,
							mixed_flag_status_show: 0,
							error_code: 0,
							m_mcu_status_value: 0,
							write_param_success_flag: false,
							reset_mcu_success_flag: false,
							connected: true,
							Storage_deviceId: "",
							auto_conect: true,
							CAN_debug_mode: false,
							fork_select_flag: false,
							as: "k8BsXmqKQTQ7L1ifHnF2l03EPYG3h7", //AccessKey Secret
							ble_productKey:"a1Rug9biACL",
							productKey: "a1qEt2hbIqy",
							productSecret: "hNy9fEImzmTVlLnI",
							deviceName: "123456789",
							endpoint: "https://iot.cn-shanghai.aliyuncs.com",
							ai: "LTAI5tCLd4RwbUb9EYK8p2mP", //AccessKeyId
							apiVersion: '2018-01-20',
							ble_uuid: "123456702",
							wx_openid:"",
							services_uuid:"",
							services_name:"",
							ble_ManufacturerData:"",
							client:null,
							ble_write_enable:false,//true
							mqtt_tx_enable:false
						  }
					app.globalData.connected = true;
					app.globalData.is_yuancheng = 0;
					app.globalData.error_code = 0;
					
					uni.setStorageSync('dev_data', that.data.json_arr);
					//that.data.lan_bug
					// uni.setStorageSync('lan_bug',0)
					
					// uni.setStorageSync('deviceInfo',that.data.deviceInfo)
					// uni.setStorageSync('serviceInfo',that.data.serviceInfo)
					// that.lan_bug = 0;
					
					if(that.lang == 1){
							 uni.showToast({
							   title: 'Import was successful',
							   icon: 'none',
							   duration: 1500
							 })
					}else{
							 uni.showToast({
							   title: '导入成功',
							   icon: 'none',
							   duration: 1500
							 })
					}
					
					//wx.navigateTo({url: '/pages/showing/showing'})
				}else{
				
					 let inifile_path;
					uni.request({
					  url: this.data.file,
					  method: 'POST',
					  data: {
					    username: 'test',
					    password: '123456'
					  },
					  success: function(res) {
						  
						console.log(res.data,979797)
					    that.import_pararm_config(res.data);
					  }
					})
				}
				
				
		
				
				// 
			
				// console.log(this.data.json_arr.softstart_level_index);
				
				// uni.showToast({
				// 	title: '保存成功',
				// 	icon:"none"
				// })
			},
			 import_pararm_config: function (file_res) {
			    let that = this;
			    let k = 0, j, n;
			    let BUFFERSIZE = 24;
			    let RxBuffer = new Uint8Array(24);
			    let str = file_res.split("\r\n");
			    for (j = 1; j < 8; j++) {
			      RxBuffer[4] = j;
			      for (n = 5; n < BUFFERSIZE - 2; n++) {
			
			        RxBuffer[n] = parseInt(str[k++]);
			      }
			      that.funReadPage(RxBuffer);
			
			    }
			  },/**/
			  funReadPage(RxBuffer) {
				let that = this;
			    console.log('读取页面', RxBuffer)
			    var BUFFERSIZE = 24
			    var temp = 0
			    switch (RxBuffer[4]) {
			      case 1:
			        {
			          if (RxBuffer[5] == 0x05) {
			            temp = 0
			          } else if (RxBuffer[5] == 0x0a) {
			            temp = 1
			          } else if (RxBuffer[5] == 0x14) {
			            temp = 2
			          } else if (RxBuffer[5] == 0x1e) {
			            temp = 3
			          } else if (RxBuffer[5] == 0x28) {
			            temp = 4
			          }
			          this.data.pm_type_index = temp
			          this.data.voltage_level_index = RxBuffer[6] & 0xf
			          this.data.manufacturer_code_index = (RxBuffer[6] >> 4) & 0xf
			          this.data.over_voltage_value = ((RxBuffer[7] << 8) | RxBuffer[8]) / 10
			          this.data.under_voltage_value = ((RxBuffer[16] << 8) | RxBuffer[17]) / 10
			          this.data.soft_under_voltage_value = ((RxBuffer[9] << 8) | RxBuffer[10]) / 10
			          this.data.under_voltage_threshold_value = RxBuffer[11] / 10
			          this.data.bus_current_limit_value = (RxBuffer[12] << 8) | RxBuffer[13]
			          this.data.phase_current_value = (RxBuffer[14] << 8) | RxBuffer[15]
			          this.data.vol_calibration_value = (RxBuffer[18] << 8) | RxBuffer[19]
			          this.data.cur_calibration_value = (RxBuffer[20] << 8) | RxBuffer[21]
			      
			  		
			  	
			  				// setTimeout(function () {
			  				// 	 uni.navigateBack({//返回上一个页面
			  				// 		delta: 1
			  				// 	 });
			  				// }, 500);
			  				
			        }
			        break
			      case 2:
			        {
			          temp = (RxBuffer[5] << 8) | RxBuffer[6]
			          this.data.sport_bus_current_limit = temp
			  
			          temp = RxBuffer[7]
			          this.data.low_speed_percent = temp
			  
			          temp = RxBuffer[8]
			          this.data.mid_speed_percent = temp
			  
			          temp = RxBuffer[9]
			          this.data.high_speed_percent = temp
			  
			          temp = (RxBuffer[10] << 8) | RxBuffer[11]
			          this.data.flux_weak_value = temp
			  
			          temp = (RxBuffer[12] << 8) | RxBuffer[13]
			          this.data.phase_Kp = temp
			  
			          temp = (RxBuffer[14] << 8) | RxBuffer[15]
			          this.data.phase_current_limit_value = temp
			  
			          temp = RxBuffer[17]
			          this.data.turtle_speed_pecent = temp
			  
			          if ((RxBuffer[16] & 0x80) != 0) {
			            //page1.m_soft_start_enable.SetCheck(1);
			            this.data.soft_start_flag = true
			          } else {
			            //page1.m_soft_start_enable.SetCheck(0);
			            this.data.soft_start_flag = false
			          }
			          if ((RxBuffer[16] & 0x40) != 0) {
			            //page3.m_low_ebreak_enable.SetCheck(1);
			            this.data.motor_noise_forbid_falg = true
			          } else {
			            //page3.m_low_ebreak_enable.SetCheck(0);
			            this.data.motor_noise_forbid_falg = false
			          }
			          if ((RxBuffer[16] & 0x20) != 0) {
			            //page1.m_self_lock_switch_enable = 1;
			            //this.setData({safe_start_enable_flag:true});
			          } else {
			            //page1.m_self_lock_switch_enable = 0;
			            //this.setData({safe_start_enable_flag:false});
			          }
			          if ((RxBuffer[16] & 0x10) != 0) {
			            //page3.m_v_type_flag = 1;
			            this.data.motor_type_selcet_value = 2
			          } else {
			            //page3.m_v_type_flag = 0;
			            this.data.motor_type_selcet_value = 1
			          }
			          if ((RxBuffer[16] & 0x20) != 0) {
			            //page3.m_v_type_flag = 1;
			            this.data.dot_switch_selcet_flag = 2
			          } else {
			            //page3.m_v_type_flag = 0;
			            this.data.dot_switch_selcet_flag = 1
			          }
			          if ((RxBuffer[16] & 0x01) != 0) {
			            //page1.m_speed_limit_enable.SetCheck(1);
			            this.data.turtle_speed_enable = true
			          } else {
			            //page1.m_speed_limit_enable.SetCheck(0);
			            this.data.turtle_speed_enable = false
			          }
			          if ((RxBuffer[16] & 0x08) != 0) {
			            //	page1.m_default_speed_value = 0;
			            this.data.default_gear = 1
			          } else if ((RxBuffer[16] & 0x04) != 0) {
			            //page1.m_default_speed_value = 1;
			            this.data.default_gear = 2
			          } else if ((RxBuffer[16] & 0x02) != 0) {
			            //page1.m_default_speed_value = 2;
			            this.data.default_gear = 4
			          }
			          if (RxBuffer[18] < 17) {
			            //page1.m_soft_start_level.SetCurSel(RxBuffer[18] - 1);
			            this.data.softstart_level_index = RxBuffer[18] - 1
			          } else {
			            this.data.softstart_level_index = 0
			          }
			          console.log(RxBuffer[18])
			          //page1.m_boost_time_limit_value = (RxBuffer[19]);
			          this.data.sport_quit_time = RxBuffer[19]
			  
			          //page1.m_boost_time_recover_value = (RxBuffer[20]);
			          this.data.sport_recover_time = RxBuffer[20]
			          //page1.m_flux_weak_param_value = RxBuffer[21];
			          this.data.flux_weak_compensate = RxBuffer[21]
			          console.log('页面2读取完成')
			  		
			        }
			        break
			      case 3:
			        {
			          temp = (RxBuffer[5] << 8) | RxBuffer[6]
			          //page3.m_hall_shift_value = temp;
			          let value = new Int16Array(1)
			          value[0] = temp
			          this.data.motor_shift_angle = value[0]
			          //page3.m_start_tempretrue_protect_value = RxBuffer[7];
			          this.data.start_tempretrue_protect_value = RxBuffer[7]
			          //page3.m_over_temperetrue_protect_value = RxBuffer[8];
			          this.data.over_temperetrue_protect_value = RxBuffer[8]
			          //page3.m_max_tempretrue_protect_value = RxBuffer[9];
			          this.data.max_tempretrue_protect_value = RxBuffer[9]
			          temp = (RxBuffer[10] << 8) | RxBuffer[11]
			          //page3.m_tempretrue_fact1 = temp;
			          this.data.tempretrue_fact = temp
			          temp = (RxBuffer[12] << 8) | RxBuffer[13]
			          //page3.m_tempretrue_fact2 = temp;
			          this.data.adj_fact1 = temp
			          temp = (RxBuffer[14] << 8) | RxBuffer[15]
			          //page3.m_tempretrue_fact3 = temp;
			          this.data.adj_fact2 = temp
			          if ((RxBuffer[17] & 0x80) != 0) {
			            this.data.set_motor_dir = 2
			          } else {
			            this.data.set_motor_dir = 1
			          }
			          if ((RxBuffer[17] & 0x40) != 0) {
			            //	page1.m_sport_auto_quit_enable.SetCheck(1);
			            this.data.sport_auto_quit_enable = true
			          } else {
			            //page1.m_sport_auto_quit_enable.SetCheck(0);
			            this.data.sport_auto_quit_enable = false
			          }
			          if ((RxBuffer[17] & 0x20) != 0) {
			            //page3.m_hall_changed.SetCheck(1);
			            this.data.exchange_hall_flag = true
			          } else {
			            //page3.m_hall_changed.SetCheck(0);
			            this.data.exchange_hall_flag = false
			          }
			          if ((RxBuffer[17] & 0x10) != 0) {
			            //page3.m_phase_changed.SetCheck(1);
			            this.data.exchange_motor_phase_flag = true
			          } else {
			            //page3.m_phase_changed.SetCheck(0);
			            this.data.exchange_motor_phase_flag = false
			          }
			          if ((RxBuffer[17] & 0x08) != 0) {
			            //page1.m_park_enalbe.SetCheck(1);
			            this.data.auto_park_enable = true
			          } else {
			            //page1.m_park_enalbe.SetCheck(0);
			            this.data.auto_park_enable = false
			          }
			          //	page3.m_reverse_speed_limit_value = RxBuffer[16];
			          this.data.reverse_speed_limit_percent = RxBuffer[16]
			  
			          //page3.m_motor_pair = RxBuffer[18];
			          this.data.motor_pole_pair = RxBuffer[18]
			          //page3.m_ebs_value = RxBuffer[19];
			          this.data.ebs_percent = RxBuffer[19]
			          //page0.m_software_vision = RxBuffer[20];
			          //page0.m_software_vision /= 100;
			          this.data.software_vision = RxBuffer[20] / 100
			          //page0.m_hardware_vision = RxBuffer[21];
			          //page0.m_hardware_vision /= 100;
			          this.data.m_hardware_vision = RxBuffer[21] / 100
			          console.log('页面3读取完成')
			  		
			        }
			        break
			      case 4:
			        {
			          if ((RxBuffer[5] & 0x01) != 0) {
			            //page3.m_aux_torque_enable.SetCheck(1);
			            this.data.aux_move_enable_flag = true
			          } else {
			            //page3.m_aux_torque_enable.SetCheck(0);
			            this.data.aux_move_enable_flag = false
			          }
			          if ((RxBuffer[5] & 0x02) != 0) {
			            //page1.m_hill_down_enalbe.SetCheck(1);
			            this.data.max_speed_limit_enable = true
			          } else {
			            //page1.m_hill_down_enalbe.SetCheck(0);
			            this.data.max_speed_limit_enable = false
			          }
			          if ((RxBuffer[5] & 0x04) != 0) {
			            //page3.m_output_select_flag = 0;
			            this.data.output_type_selcet_value = 1
			          } else {
			            //page3.m_output_select_flag = 1;
			            this.data.output_type_selcet_value = 2
			          }
			          if ((RxBuffer[5] & 0x08) != 0) {
			            //page3.m_cruise_enable.SetCheck(1);
			            this.data.cruise_enable_flag = true
			          } else {
			            //page3.m_cruise_enable.SetCheck(0);
			            this.data.cruise_enable_flag = false
			          }
			          if ((RxBuffer[5] & 0x10) != 0) {
			            //page3.m_double_voltage_enable.SetCheck(1);
			            this.data.double_voltage_enable = true
			          } else {
			            //page3.m_double_voltage_enable.SetCheck(0);
			            this.data.double_voltage_enable = false
			          }
			          if ((RxBuffer[5] & 0x20) != 0) {
			            //page3.m_double_voltage_select = true;
			            this.data.double_voltage_value = 2
			          } else {
			            //page3.m_double_voltage_select = false;
			            this.data.double_voltage_value = 1
			          }
			          if ((RxBuffer[5] & 0x40) != 0) {
			            //page3.m_safe_start_vaild.SetCheck(1);
			            this.data.safe_start_enable_flag = true
			          } else {
			            //page3.m_safe_start_vaild.SetCheck(0);
			            this.data.safe_start_enable_flag = false
			          }
			          temp = (RxBuffer[8] << 8) | RxBuffer[9]
			          //page3.m_aux_torque_limit_value = temp;
			          this.data.aux_torque_limit_value = temp
			          temp = (RxBuffer[6] << 8) | RxBuffer[7]
			          //page3.m_aux_speed_limit_value = ((temp * 100 + 99) / 32768);
			          this.data.aux_speed_limit_percent = (temp * 100 + 99) / 32768
			  
			          temp = (RxBuffer[10] << 8) | RxBuffer[11]
			          //page1.m_DH_SP_VALUE = temp;
			          this.data.max_speed_limit_value = temp
			  
			          temp = RxBuffer[12]
			          //page1.m_h_egear_1_value = temp;
			          this.data.low_speed_limit_current_percet = temp
			  
			          temp = RxBuffer[13]
			          //page1.m_h_egear_2_value = temp;
			          this.data.mid_speed_limit_current_percet = temp
			  
			          temp = RxBuffer[14]
			          //page1.m_h_egear_3_value = temp;
			          this.data.over_module_percent = temp
			  
			          temp = (RxBuffer[15] << 8) | RxBuffer[16]
			          //page1.m_h_s_gear_flux_weak_value = temp;
			          this.data.phase_Ki = temp
			  
			          temp = (RxBuffer[17] << 8) | RxBuffer[18]
			          //page1.m_h_egear_3_flux_weak_value = temp;
			          this.data.rated_phase_current_value = temp
			  
			          temp = (RxBuffer[19] << 8) | RxBuffer[20]
			          //page1.m_h_egear_2_flux_weak_value = temp;
			          this.data.rated_phase_current_limit_time = temp
			          console.log('页面4读取完成')
			        }
			        break
			      case 5:
			        {
			          /*union_IO_setup temp});
			          for (let i:0}); i<8}); i++)
			          {
			            temp.IO_setup_byte:(RxBuffer[5 + i * 2] << 8 | RxBuffer[6 + i * 2])});
			            (CComboBox *)(*ptr_function_list_tab[i]).SetCurSel(temp.IO_setup_bit.function)});
			            *ptr_input_status_value_tab[i]:temp.IO_setup_bit.input_status_set});
			            (*ptr_input_select_tab[i]).SetCheck(temp.IO_setup_bit.input_output)});
			            (*ptr_SW_select_tab[i]).SetCheck(temp.IO_setup_bit.switch_butten)});
			            (*ptr_low_active_select_tab[i]).SetCheck(temp.IO_setup_bit.active_low)});
			          }*/
			          let i = 0
			          temp = (RxBuffer[5 + i * 2] << 8) | RxBuffer[6 + i * 2]
			          this.data.function_select_index0 = temp & 0x7f
			          this.data.function_select_radiobox0 = 1 << ((temp >> 9) & 0x03)
			          this.data.function_select_checkbox0 = ((temp >> 7) & 0x03) + ((temp >> 9) & 0x04)
			          i++
			          temp = (RxBuffer[5 + i * 2] << 8) | RxBuffer[6 + i * 2]
			          this.data.function_select_index1 = temp & 0x7f
			          this.data.function_select_radiobox1 = 1 << ((temp >> 9) & 0x03)
			          this.data.function_select_checkbox1 = ((temp >> 7) & 0x03) + ((temp >> 9) & 0x04)
			          i++
			          temp = (RxBuffer[5 + i * 2] << 8) | RxBuffer[6 + i * 2]
			          this.data.function_select_index2 = temp & 0x7f
			          this.data.function_select_radiobox2 = 1 << ((temp >> 9) & 0x03)
			          this.data.function_select_checkbox2 = ((temp >> 7) & 0x03) + ((temp >> 9) & 0x04)
			          i++
			          temp = (RxBuffer[5 + i * 2] << 8) | RxBuffer[6 + i * 2]
			          this.data.function_select_index3 = temp & 0x7f
			          this.data.function_select_radiobox3 = 1 << ((temp >> 9) & 0x03)
			          this.data.function_select_checkbox3 = ((temp >> 7) & 0x03) + ((temp >> 9) & 0x04)
			          i++
			          temp = (RxBuffer[5 + i * 2] << 8) | RxBuffer[6 + i * 2]
			          this.data.function_select_index4 = temp & 0x7f
			          this.data.function_select_radiobox4 = 1 << ((temp >> 9) & 0x03)
			          this.data.function_select_checkbox4 = ((temp >> 7) & 0x03) + ((temp >> 9) & 0x04)
			          i++
			          temp = (RxBuffer[5 + i * 2] << 8) | RxBuffer[6 + i * 2]
			          this.data.function_select_index5 = temp & 0x7f
			          this.data.function_select_radiobox5 = 1 << ((temp >> 9) & 0x03)
			          this.data.function_select_checkbox5 = ((temp >> 7) & 0x03) + ((temp >> 9) & 0x04)
			          i++
			          temp = (RxBuffer[5 + i * 2] << 8) | RxBuffer[6 + i * 2]
			          this.data.function_select_index6 = temp & 0x7f
			          this.data.function_select_radiobox6 = 1 << ((temp >> 9) & 0x03)
			          this.data.function_select_checkbox6 = ((temp >> 7) & 0x03) + ((temp >> 9) & 0x04)
			          i++
			          temp = (RxBuffer[5 + i * 2] << 8) | RxBuffer[6 + i * 2]
			          this.data.function_select_index7 = temp & 0x7f
			          this.data.function_select_radiobox7 = 1 << ((temp >> 9) & 0x03)
			          this.data.function_select_checkbox7 = ((temp >> 7) & 0x03) + ((temp >> 9) & 0x04)
			          //flux_weak_calibration_value:RxBuffer[21]});
			          this.data.flux_weak_calibration_value = RxBuffer[21]
			          console.log('页面5读取完成')
			        }
			        break
			      case 6:
			        {
			          /*union_IO_setup temp});
			  
			          for (int i:8}); i<16}); i++)
			          {
			            temp.IO_setup_byte:(RxBuffer[5 + (i - 8) * 2] << 8 | RxBuffer[6 + (i - 8) * 2])});
			            (CComboBox *)(*ptr_function_list_tab[i]).SetCurSel(temp.IO_setup_bit.function)});
			            *ptr_input_status_value_tab[i]:temp.IO_setup_bit.input_status_set});
			            (*ptr_input_select_tab[i]).SetCheck(temp.IO_setup_bit.input_output)});
			            (*ptr_SW_select_tab[i]).SetCheck(temp.IO_setup_bit.switch_butten)});
			            (*ptr_low_active_select_tab[i]).SetCheck(temp.IO_setup_bit.active_low)});
			          }
			  
			          _m_can_burad:RxBuffer[21] >> 4});
			          _m_can_ID:RxBuffer[21] & 0xf});
			          for (int i:5}); i<BUFFERSIZE - 2}); i++)
			          {
			            page5_tx_message[i]&0xff):RxBuffer[i]});
			          }*/
			          let i = 8
			          temp = (RxBuffer[5 + (i - 8) * 2] << 8) | RxBuffer[6 + (i - 8) * 2]
			          this.data.function_select_index8 = temp & 0x7f
			          this.data.function_select_radiobox8 = 1 << ((temp >> 9) & 0x03)
			          this.data.function_select_checkbox8 = ((temp >> 7) & 0x03) + ((temp >> 9) & 0x04)
			          i++
			          temp = (RxBuffer[5 + (i - 8) * 2] << 8) | RxBuffer[6 + (i - 8) * 2]
			          this.data.function_select_index9 = temp & 0x7f
			          this.data.function_select_radiobox9 = 1 << ((temp >> 9) & 0x03)
			          this.data.function_select_checkbox9 = ((temp >> 7) & 0x03) + ((temp >> 9) & 0x04)
			          i++
			          temp = (RxBuffer[5 + (i - 8) * 2] << 8) | RxBuffer[6 + (i - 8) * 2]
			          this.data.function_select_index10 = temp & 0x7f
			          this.data.function_select_radiobox10 = 1 << ((temp >> 9) & 0x03)
			          this.data.function_select_checkbox10 = ((temp >> 7) & 0x03) + ((temp >> 9) & 0x04)
			          i++
			          temp = (RxBuffer[5 + (i - 8) * 2] << 8) | RxBuffer[6 + (i - 8) * 2]
			          this.data.function_select_index11 = temp & 0x7f
			          this.data.function_select_radiobox11 = 1 << ((temp >> 9) & 0x03)
			          this.data.function_select_checkbox11 = ((temp >> 7) & 0x03) + ((temp >> 9) & 0x04)
			          i++
			          temp = (RxBuffer[5 + (i - 8) * 2] << 8) | RxBuffer[6 + (i - 8) * 2]
			          this.data.function_select_index12 = temp & 0x7f
			          this.data.function_select_radiobox12 = 1 << ((temp >> 9) & 0x03)
			          this.data.function_select_checkbox12 = ((temp >> 7) & 0x03) + ((temp >> 9) & 0x04)
			          i++
			          temp = (RxBuffer[5 + (i - 8) * 2] << 8) | RxBuffer[6 + (i - 8) * 2]
			          this.data.function_select_index13 = temp & 0x7f
			          this.data.function_select_radiobox13 = 1 << ((temp >> 9) & 0x03)
			          this.data.function_select_checkbox13 = ((temp >> 7) & 0x03) + ((temp >> 9) & 0x04)
			          i++
			          temp = (RxBuffer[5 + (i - 8) * 2] << 8) | RxBuffer[6 + (i - 8) * 2]
			          this.data.function_select_index14 = temp & 0x7f
			          this.data.function_select_radiobox14 = 1 << ((temp >> 9) & 0x03)
			          this.data.function_select_checkbox14 = ((temp >> 7) & 0x03) + ((temp >> 9) & 0x04)
			          i++
			          temp = (RxBuffer[5 + (i - 8) * 2] << 8) | RxBuffer[6 + (i - 8) * 2]
			          this.data.function_select_index15 = temp & 0x7f
			          this.data.function_select_radiobox15 = 1 << ((temp >> 9) & 0x03)
			          this.data.function_select_checkbox15 = ((temp >> 7) & 0x03) + ((temp >> 9) & 0x04)
			          console.log('页面6读取完成')
			        }
			        break
			      case 7:
			        {
			          //page0.m_footplat_start_value = floor((RxBuffer[5] * 550 / 255) + 2.2) / 100;
			          this.data.footplat_start_value = Math.floor((RxBuffer[5] * 550) / 255 + 2.2) / 100
			          //page0.m_footplat_end_value = floor((RxBuffer[6] * 550 / 255) + 2.2) / 100;
			          this.data.footplat_end_value = Math.floor((RxBuffer[6] * 550) / 255 + 2.2) / 100
			          //page0.m_footplat_low_protect_value = floor((RxBuffer[7] * 550 / 255) + 2.2) / 100;
			          this.data.footplat_low_protect_value = Math.floor((RxBuffer[7] * 550) / 255 + 2.2) / 100
			          //page0.m_footplat_high_protect_value = floor((RxBuffer[8] * 550 / 255) + 2.2) / 100;
			          this.data.footplat_high_protect_value = Math.floor((RxBuffer[8] * 550) / 255 + 2.2) / 100
			          //page0.m_sink_ratio = RxBuffer[9];
			          this.data.sink_ratio = RxBuffer[9]
			          //page0.m_rise_ratio = RxBuffer[10];
			          this.data.rise_ratio = RxBuffer[10]
			          //page0.m_start_torque = (RxBuffer[11] << 8 | RxBuffer[12]);
			          this.data.start_torque = (RxBuffer[11] << 8) | RxBuffer[12]
			          //page0.m_combine_torque = (RxBuffer[13] << 8 | RxBuffer[14]);
			          this.data.combine_torque = (RxBuffer[13] << 8) | RxBuffer[14]
			          //calibration_value_show_flag = true;
			          console.log('页面7读取完成')
			        }
			        break
			      default:
			        console.log('未知页面！！！11')
			        break
			    }
				
				console.log(that.data,888888888)
				
				uni.setStorageSync('dev_data', that.data);
				// uni.setStorageSync('lan_bug',0);
				// that.lan_bug = 0;
				
				
				// uni.showToast({ title: '导入成功' })
				// if(this.lang == 1){
				// 		 uni.showToast({
				// 		   title: 'Import was successful',
				// 		   icon: 'none'
				// 		 })
				// }else{
				// 		 uni.showToast({
				// 		   title: '导入成功1',
				// 		   icon: 'none'
				// 		 })
				// }
				
			
					uni.hideLoading();
				
				
				
					// uni.setStorageSync('lan_bug',that.data.lan_bug)
					// uni.setStorageSync('deviceInfo',that.data.deviceInfo)
					// uni.setStorageSync('serviceInfo',that.data.serviceInfo)
			
				
			  },
			open(){
				console.log(this.data.is_lan)
			},
			get_info() {
				let _this = this;
				this.$api.request('/api/index/getxiliedea', {
					page: this.page,
					id:this.id
				}, this.$store.state.token, function(res){
					if(res.code == 1) {
						
						_this.data = res.data;
						
					}
				});
			},
			change(e){
				this.huadong1 = e;
				console.log(e,7777777)
			},
			change1(e){
				this.huadong2 = e;
				console.log(e,7777777)
			},
			goSearch() {
				uni.navigateTo({
					url: '../search/search'
				})
			},
			goList() {
				uni.navigateTo({
					url: '../goodsList/goodsList'
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	
	.xiazai{
		height: 100vh;
		background: #111823;
		width: 100%;
		float: left;
		.left{
			float: left;
		}
		.right{
			float:right;
		}
		// padding-bottom: 100rpx;
		
		.nav_top{
			width: 94%;
			margin-left: 3%;
			heigth:30px;
			color:#fff;
			background: #111823;
		}
		
		.nav_menus{
			margin-top: 7px;
			width:100%;
			color: #fff;
			.titie_top{
				background:#293241;
				height: 40px;
				line-height: 40px;
				.top_left{
					color:#fff;
					margin-left:3%;
					.text{
						font-size: 22rpx;
					}
				}
				.top_right{
					margin-right: 3%;
					image{
						margin-top: 10px;;
						width: 20px;
						height: 20px;
						
					}
				}
			}
			.titie_body{
				margin-top: 1px;
				background:#293241;
				height: 60px;
				line-height:60px;
				.body_line{
					margin-left: 3%;
					width: 94%;
					.left{
						float: left;
						input{
							width: 140px;
							background: #545b67;
							height: 30px;
							line-height:30px;
							text-align: center;
							margin-top: 10px;
							margin-right: 3%;;
						}
						.ts{
							height: 35px;
						}
						.ts1{
							height: 30px;
						}
					}
					.right{
						height: 40px;
						float: right;
						input{
							width: 140px;
							background: #545b67;
							height: 30px;
							line-height:30px;
							text-align: center;
							margin-top: 10px;
							margin-right: 3%;;
						}
						.text{
							font-size: 22rpx;
						}
						.evan-switch{
							margin-top: 11px;
						}
						.uv-radio{
							margin-top: 8px;
						}
						.huadong{
							width: 130px;
							margin-top: 18px;
							margin-right: 20px;
							.fonts{
								color:#507afe ;
								font-size: 14px;
								float: right;
								width: 15px;
								text-align: center;
								position: relative;
								top:-33px;
								right: -20px;
							}
						}
						.ts{
							height: 35px;
						}
						.ts1{
							height: 30px;
						}
					}
				}
				
			}
			.titie_body1{
				height: 90px;
			}
		}
		
		.bomt{
			color: #fff;
			background: #545b67;
			position: fixed;
			bottom: 0px;
			width: 100%;
			height: 60px;
			line-height: 40px;
			float: left;
			
			.bom_top{
				width: 20%;
				float: left;
				text-align: center;
				margin: 0 auto;
				line-height: 20px;
				.top1{
					image{
						margin: 0 auto;
						margin-top: 12px;
						width: 40rpx;
						height: 42rpx;
					}
					font-size: 10px;
				}
				
			}
			.bom_left{
				margin-top: 12px;
				width: 45%;
				text-align: center;
				height: 35px;
				line-height: 35px;
				border-radius: 5em;
				float: left;
				background: #507afe;
				border:1px solid #507afe;
			}
			.bom_right{
				margin-top: 12px;
				margin-left: 4%;;
				width:45%;
				text-align: center;
				height: 35px;
				line-height: 35px;
				border-radius: 5em;
				float: right;
				background: #44b31d;
			}
		}
		
		.rightimg{
			width: 16rpx;
			height: 26rpx;
			float: right;
			margin-left: 10px;
			margin-top: 18px;
		}
		
		.rightimg1{
			width: 40rpx;
			height: 40rpx;
			float: right;
			margin-left: 10px;
			margin-top: 20px;
		}
		
		.rightimg_str{
			width: 80px;;
			color:#fff;
			float:right;
			height: 50rpx;
			line-height: 50rpx;
			font-size: 13px;
			background: #44b31d;
			border-radius: 5em;
			margin-right: 5px;
			text-align: center;
			margin-top: 35rpx;
		}
	}

</style>
